﻿using System;
using System.Collections.Generic;
using System.Web.UI.WebControls;
using Ue.Framework;
using Ue.Framework.Web.WebControls;
using Ue.Infrastructure.DomainBase;
using Ue.Infrastructure.Web.UI;
using Ue.Qcdz.Domain.TreeViews;

namespace Ue.Qcdz.UI.Controls
{
    public class TreeViewEdit : SkinnedEntityEdit<Ue.Qcdz.Domain.TreeViews.TreeView>
    {
        private TextBox tbxName;
        private TextBox tbxDescription;

        protected override Ue.Qcdz.Domain.TreeViews.TreeView Enttiy
        {
            get
            {
                return new Ue.Qcdz.Domain.TreeViews.TreeView(this.EntityKey)
                {
                     Name=tbxName.GetValue<string>(),
                     Description=tbxDescription.GetValue<string>()
                };
            }
            set
            {
                if (value != null)
                {
                    tbxName.SetValue(value.Name);
                    tbxDescription.SetValue(value.Description);
                }
            }
        }

        protected override void InitSkin(System.Web.UI.Control skin)
        {
            tbxName = skin.FindControl<TextBox>("tbxName");
            tbxDescription = skin.FindControl<TextBox>("tbxDescription");
        }

        protected override string GetSkinFileName()
        {
            return "~/Admin/Themes/Skins/TreeViews/TreeViewEdit.ascx";
        }
    }
}
